package com.dgut.common.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dgut.common.entity.UserInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dgut.common.result.CollectorResult;
import com.dgut.common.result.UserInfoResult;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zyq
 * @since 2022-03-13
 */
@Repository
public interface UserInfoMapper extends BaseMapper<UserInfo> {


    @Select("select * from user_info where user_id = #{id} and state = #{state} limit 1")
    UserInfo selectByUserId(@Param("id") Integer id, @Param("state") Integer state);

    @Select("select * from user_info where user_id = #{id} limit 1")
    UserInfo selectByUserIdNoState(@Param("id") Integer id);


    Page<UserInfoResult> selectMyPage(IPage<UserInfoResult> page, String name, Integer state);

    Page<CollectorResult> selectCollectorPage(IPage<CollectorResult> page, String name, Integer state);

}
